*------------------------------------------------------------------------------*
* 	Table 6: Gender Discr. Effects by Officer's Gender Preference - OLS        *
*------------------------------------------------------------------------------*
{
cd "$data"
use ExperimentalData_Applications_NonAttrit, clear

********* Columns (1) , (2), and (3)

*Standard Errors clustered at the bank-branch level (in parenthesis)

local off_female off_female
local regionbankfeall d_region_bank_fe_all1-d_region_bank_fe_all54
local loanamount credit_asked_ammount_cat1-credit_asked_ammount_cat8   
local weekfe d_week1-d_week22
local salience treat
local indivcovariates app_age_below_29 app_age_29_38 app_married app_wage_600_1200 app_wage_above_1200 app_self_employed app_bank_client d_miss_app_married d_miss_app_self_employed
local execcovariates off_higher_educ off_exp_6_or_less off_exp_7_to_12 off_age_18_28 off_age_29_48 
			
foreach outcome of varlist application_responded if_asked_more application_approved {
            regress `outcome' app_female##pro_male_portfolio `off_female' `regionbankfeall' `indivcovariates' `execcovariates' `loanamount' `weekfe' `salience', cluster(region_bank_fe)
			sum `outcome' if app_female==0
			local mean_male1 = r(mean)	
			outreg2 1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio using "${tables}/Table6_cols_1_2_3_cse.xls", keep(1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio) addstat("mean_male", `mean_male1') adec(3) excel `append' bdec(3) sdec(3) stats(coef se) auto(3) alpha(.01, .05, .10) symbol(***,**,*) br
            local append "append"            
			}  

			
*Bootstrapped Standard Errors (in brackets)

sort aux_id

local off_female off_female
local regionbankfeall d_region_bank_fe_all1-d_region_bank_fe_all54
local loanamount credit_asked_ammount_cat1-credit_asked_ammount_cat8   
local weekfe d_week1-d_week22
local salience treat
local indivcovariates app_age_below_29 app_age_29_38 app_married app_wage_600_1200 app_wage_above_1200 app_self_employed app_bank_client d_miss_app_married d_miss_app_self_employed
local execcovariates off_higher_educ off_exp_6_or_less off_exp_7_to_12 off_age_18_28 off_age_29_48 
 
foreach outcome of varlist application_responded if_asked_more application_approved {
            regress `outcome' app_female##pro_male_portfolio `off_female' `regionbankfeall' `indivcovariates' `execcovariates' `loanamount' `weekfe' `salience',  vce(boot, rep(3000) seed(1010101010))
			outreg2 1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio using "${tables}/Table6_cols_1_2_3_bse.xls", keep(1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio) excel `append' bdec(3) sdec(3) stats(coef se) auto(3) alpha(.01, .05, .10) symbol(***,**,*) br
            local append "append"            
			}  

			
			
**** column 4

*Standard Errors clustered at the bank-branch level (in parenthesis)
		
local off_female off_female
local regionbankfeask d_region_bank_fe_ask1-d_region_bank_fe_ask44
local loanamount credit_asked_ammount_cat1-credit_asked_ammount_cat8   
local weekfeask d_weekfe_ask1-d_weekfe_ask20
local salience treat
local indivcovariates app_age_below_29 app_age_29_38 app_married app_wage_600_1200 app_wage_above_1200 app_self_employed app_bank_client d_miss_app_married d_miss_app_self_employed
local execcovariates off_higher_educ off_exp_6_or_less off_exp_7_to_12 off_age_18_28 off_age_29_48 
			
foreach outcome of varlist application_approved {
			regress `outcome' app_female##pro_male_portfolio `off_female' `regionbankfeask' `indivcovariates' `execcovariates' `loanamount' `weekfeask' `salience' if if_asked_more==1, cluster(region_bank_fe)
			sum `outcome' if app_female==0 & if_asked_more==1
			local mean_male1 = r(mean)	
			outreg2 1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio using "${tables}/Table6_cols_4_cse.xls", keep(1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio) addstat("mean_male", `mean_male1') adec(3) excel `append' bdec(3) sdec(3) stats(coef se) auto(3) alpha(.01, .05, .10) symbol(***,**,*) br
            local append "append"
}

*Bootstrapped Standard Errors (in brackets) -- Using frisch-waug to compute bootstrapped standard errors

gen interaction = app_female*pro_male_portfolio

local off_female off_female
local regionbankfeask d_region_bank_fe_ask1-d_region_bank_fe_ask44
local loanamount credit_asked_ammount_cat1-credit_asked_ammount_cat8   
local weekfeask d_weekfe_ask1-d_weekfe_ask20
local salience treat
local indivcovariates app_age_below_29 app_age_29_38 app_married app_wage_600_1200 app_wage_above_1200 app_self_employed app_bank_client d_miss_app_married d_miss_app_self_employed
local execcovariates off_higher_educ off_exp_6_or_less off_exp_7_to_12 off_age_18_28 off_age_29_48 

*partialling out application_accepted for female
reg application_approved pro_male_portfolio interaction `off_female' `regionbankfeask' `indivcovariates' `execcovariates' `loanamount' `weekfeask' `salience' if if_asked_more==1
predict acc_tilda_female, res

*partialling out application_accepted for pro_male_portfolio
reg application_approved app_female interaction `off_female' `regionbankfeask' `indivcovariates' `execcovariates' `loanamount' `weekfeask' `salience' if if_asked_more==1
predict acc_tilda_prom, res

*partialling out application_accepted for interaction
reg application_approved app_female pro_male_portfolio `off_female' `regionbankfeask' `indivcovariates' `execcovariates' `loanamount' `weekfeask' `salience' if if_asked_more==1
predict acc_tilda_inter, res

*partialling out female
reg app_female pro_male_portfolio interaction `off_female' `regionbankfeask' `indivcovariates' `execcovariates' `loanamount' `weekfeask' `salience' if if_asked_more==1
predict acc_fem_tilda, res

*partialling out salience_july_2018
reg pro_male_portfolio app_female interaction `off_female' `regionbankfeask' `indivcovariates' `execcovariates' `loanamount' `weekfeask' `salience' if if_asked_more==1
predict acc_prom_tilda, res

*partialling out interaction
reg interaction app_female pro_male_portfolio `off_female' `regionbankfeask' `indivcovariates' `execcovariates' `loanamount' `weekfeask' `salience' if if_asked_more==1
predict acc_inter_tilda, res

sort aux_id

*frisch-waugh female
reg acc_tilda_female acc_fem_tilda if if_asked_more==1, vce(boot, rep(3000) seed(1010101010))
*frisch-waugh treat
reg acc_tilda_prom acc_prom_tilda if if_asked_more==1, vce(boot, rep(3000) seed(1010101010))
*frisch-waugh inter
reg acc_tilda_inter acc_inter_tilda if if_asked_more==1, vce(boot, rep(3000) seed(1010101010))


**** column 5


*Standard Errors clustered at the bank-branch level (in parenthesis)
		
local off_female off_female
local regionbankfenotask d_region_bank_fe_notask1-d_region_bank_fe_notask50
local loanamount credit_asked_ammount_cat1-credit_asked_ammount_cat8   
local weekfenotask d_weekfe_notask1-d_weekfe_notask22
local salience treat
local indivcovariates app_age_below_29 app_age_29_38 app_married app_wage_600_1200 app_wage_above_1200 app_self_employed app_bank_client d_miss_app_married d_miss_app_self_employed
local execcovariates off_higher_educ off_exp_6_or_less off_exp_7_to_12 off_age_18_28 off_age_29_48 

foreach outcome of varlist application_approved {
			regress `outcome' app_female##pro_male_portfolio `off_female' `regionbankfenotask' `indivcovariates' `execcovariates' `loanamount' `weekfenotask' `salience' if if_asked_more==0, cluster(region_bank_fe)
			sum `outcome' if app_female==0 & if_asked_more==0
			local mean_male1 = r(mean)	
			outreg2 1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio using "${tables}/Table6_cols_5_cse.xls", keep(1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio) addstat("mean_male", `mean_male1') adec(3) excel `append' bdec(3) sdec(3) stats(coef se) auto(3) alpha(.01, .05, .10) symbol(***,**,*) br
            local append "append"
			} 	

*Bootstrapped Standard Errors (in brackets)

sort aux_id

foreach outcome of varlist application_approved {
			regress `outcome' app_female##pro_male_portfolio `off_female' `regionbankfenotask' `indivcovariates' `execcovariates' `loanamount' `weekfenotask' `salience' if if_asked_more==0, vce(boot, rep(3000) seed(1010101010))
			outreg2 1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio using "${tables}/Table6_cols_5_bse.xls", keep(1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio) excel `append' bdec(3) sdec(3) stats(coef se) auto(3) alpha(.01, .05, .10) symbol(***,**,*) br
            local append "append"
			} 	



*** column 6


*Standard Errors clustered at the bank-branch level (in parenthesis)

local regionbankfemale d_region_bank_fe_male1-d_region_bank_fe_male32
local loanamount credit_asked_ammount_cat1-credit_asked_ammount_cat8   
local weekfemale d_weekfe_male1-d_weekfe_male21
local salience treat
local indivcovariates app_age_below_29 app_age_29_38 app_married app_wage_600_1200 app_wage_above_1200 app_self_employed app_bank_client d_miss_app_married d_miss_app_self_employed
local execcovariates off_higher_educ off_exp_6_or_less off_exp_7_to_12 off_age_18_28 off_age_29_48 

foreach outcome of varlist application_approved {
            regress `outcome' app_female##pro_male_portfolio `regionbankfemale' `indivcovariates' `execcovariates' `loanamount' `weekfemale' `salience' if off_female==0, cluster(region_bank_fe)
			sum `outcome' if app_female==0 & off_female==0
			local mean_male1 = r(mean)	
			outreg2 1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio using "${tables}/Table6_cols_6_cse.xls", keep(1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio) addstat("mean_male", `mean_male1') adec(3) excel `append' bdec(3) sdec(3) stats(coef se) auto(3) alpha(.01, .05, .10) symbol(***,**,*) br
            local append "append"            
			}  

			
			
*Bootstrapped Standard Errors (in brackets)

sort aux_id

local regionbankfemale d_region_bank_fe_male1-d_region_bank_fe_male32
local loanamount credit_asked_ammount_cat1-credit_asked_ammount_cat8   
local weekfemale d_weekfe_male1-d_weekfe_male21
local salience treat
local indivcovariates app_age_below_29 app_age_29_38 app_married app_wage_600_1200 app_wage_above_1200 app_self_employed app_bank_client d_miss_app_married d_miss_app_self_employed
local execcovariates off_higher_educ off_exp_6_or_less off_exp_7_to_12 off_age_18_28 off_age_29_48 

foreach outcome of varlist application_approved {
            regress `outcome' app_female##pro_male_portfolio `regionbankfemale' `indivcovariates' `execcovariates' `loanamount' `weekfemale' `salience' if off_female==0, vce(boot, rep(3000) seed(1010101010))
			outreg2 1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio using "${tables}/Table6_cols_6_bse.xls", keep(1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio) excel `append' bdec(3) sdec(3) stats(coef se) auto(3) alpha(.01, .05, .10) symbol(***,**,*) br
            local append "append"            
			}  

			
*** column 7


*Standard Errors clustered at the bank-branch level (in parenthesis)

local regionbankfefemale d_region_bank_fe_female1-d_region_bank_fe_female48
local loanamount credit_asked_ammount_cat1-credit_asked_ammount_cat8   
local weekfefemale d_weekfe_female1-d_weekfe_female22
local salience treat
local indivcovariates app_age_below_29 app_age_29_38 app_married app_wage_600_1200 app_wage_above_1200 app_self_employed app_bank_client d_miss_app_married d_miss_app_self_employed
local execcovariates off_higher_educ off_exp_6_or_less off_exp_7_to_12 off_age_18_28 off_age_29_48 

			
foreach outcome of varlist application_approved {
            regress `outcome' app_female##pro_male_portfolio `regionbankfefemale' `indivcovariates' `execcovariates' `loanamount' `weekfefemale' `salience' if off_female==1, cluster(region_bank_fe)
			sum `outcome' if app_female==0 & off_female==1
			local mean_male1 = r(mean)	
			outreg2 1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio using "${tables}/Table6_cols_7_cse.xls", keep(1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio) addstat("mean_male", `mean_male1') adec(3) excel `append' bdec(3) sdec(3) stats(coef se) auto(3) alpha(.01, .05, .10) symbol(***,**,*) br

            local append "append"            
			}  

			
*Bootstrapped Standard Errors (in brackets)

sort aux_id

local regionbankfefemale d_region_bank_fe_female1-d_region_bank_fe_female48
local loanamount credit_asked_ammount_cat1-credit_asked_ammount_cat8   
local weekfefemale d_weekfe_female1-d_weekfe_female22
local salience treat
local indivcovariates app_age_below_29 app_age_29_38 app_married app_wage_600_1200 app_wage_above_1200 app_self_employed app_bank_client d_miss_app_married d_miss_app_self_employed
local execcovariates off_higher_educ off_exp_6_or_less off_exp_7_to_12 off_age_18_28 off_age_29_48 

foreach outcome of varlist application_approved {
            regress `outcome' app_female##pro_male_portfolio `regionbankfefemale' `indivcovariates' `execcovariates' `loanamount' `weekfefemale' `salience' if off_female==1, vce(boot, rep(3000) seed(1010101010))
			outreg2 1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio using "${tables}/Table6_cols_7_bse.xls", keep(1.app_female 1.pro_male_portfolio 1.app_female#1.pro_male_portfolio) excel `append' bdec(3) sdec(3) stats(coef se) auto(3) alpha(.01, .05, .10) symbol(***,**,*) br
            local append "append"            
			}  
						
			




*Multiple Hypotheses Testing: MHT p-val. follows List et al. (2021), Theorem 3.1., to report the multiplicity adjusted p-value for multiple hypothesis testing (3,000 reps.) of H0: \beta_female = 0 across the three outcomes, controlling for the specified covariates in each referred model.

gen d_fem_promale = (app_female==1 & pro_male_portfolio==1)

local off_female off_female
local regionbankfeall d_region_bank_fe_all1-d_region_bank_fe_all54
local regionbankfeask d_region_bank_fe_ask1-d_region_bank_fe_ask44
local regionbankfenotask d_region_bank_fe_notask1-d_region_bank_fe_notask50
local regionbankfemale d_region_bank_fe_male1-d_region_bank_fe_male32
local regionbankfefemale d_region_bank_fe_female1-d_region_bank_fe_female48
local loanamount credit_asked_ammount_cat1-credit_asked_ammount_cat8   
local weekfe d_week1-d_week22
local weekfeask d_weekfe_ask1-d_weekfe_ask20
local weekfenotask d_weekfe_notask1-d_weekfe_notask22
local weekfemale d_weekfe_male1-d_weekfe_male21
local weekfefemale d_weekfe_female1-d_weekfe_female22
local salience treat
local indivcovariates app_age_below_29 app_age_29_38 app_married app_wage_600_1200 app_wage_above_1200 app_self_employed app_bank_client d_miss_app_married d_miss_app_self_employed
local execcovariates off_higher_educ off_exp_6_or_less off_exp_7_to_12 off_age_18_28 off_age_29_48 
	   
sort aux_id
	   
*(1) - (3) MHT p-v. (bt)

 mhtreg (application_responded d_fem_promale app_female pro_male_portfolio `off_female' `regionbankfeall' `indivcovariates' `execcovariates' `loanamount' `weekfe' `salience') ///
        (if_asked_more d_fem_promale app_female pro_male_portfolio `off_female' `regionbankfeall' `indivcovariates' `execcovariates' `loanamount' `weekfe' `salience') ///
	    (application_approved d_fem_promale app_female pro_male_portfolio `off_female' `regionbankfeall' `indivcovariates' `execcovariates' `loanamount' `weekfe' `salience'), /// 
	   seed(1010101010) bootstrap(3000)


* (3), (4) & (5) MHT p-v. (bt)

 mhtreg (application_approved d_fem_promale app_female pro_male_portfolio `off_female' `regionbankfeall' `indivcovariates' `execcovariates' `loanamount' `weekfe' `salience') ///
 (application_approved d_fem_promale app_female pro_male_portfolio `off_female' `regionbankfeask' `indivcovariates' `execcovariates' `loanamount' `weekfeask' `salience' if if_asked_more==1) ///
        (application_approved d_fem_promale app_female pro_male_portfolio `off_female' `regionbankfenotask' `indivcovariates' `execcovariates' `loanamount' `weekfenotask' `salience' if if_asked_more==0), ///
	   seed(1010101010) bootstrap(3000)


*  (3), (6), (7) MHT p-v. (bt)

 mhtreg  (application_approved d_fem_promale app_female pro_male_portfolio `off_female' `regionbankfeall' `indivcovariates' `execcovariates' `loanamount' `weekfe' `salience') ///
         (application_approved d_fem_promale app_female pro_male_portfolio `off_female' `regionbankfemale' `indivcovariates' `execcovariates' `loanamount' `weekfemale' `salience' if off_female==0) ///
	    (application_approved d_fem_promale app_female pro_male_portfolio `off_female' `regionbankfefemale' `indivcovariates' `execcovariates' `loanamount' `weekfefemale' `salience' if off_female==1), /// 
	   seed(1010101010)  bootstrap(3000)
	   

}
        

